﻿namespace EasyLib.Patterns.Specification
{
    public class OrSpecification<T> : CompositeSpecification<T>
    {
        private ISpecification<T> one;
        private ISpecification<T> other;

        public OrSpecification(ISpecification<T> x, ISpecification<T> y)
        {
            one = x;
            other = y;
        }

        public override bool IsSatisfiedBy(T candidate)
        {
            return one.IsSatisfiedBy(candidate) || other.IsSatisfiedBy(candidate);
        }

    }
}
